package com.gf.controller.order;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import com.gf.bean.OrderrInfo;
import com.gf.service.impl.OrderrServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

/*
*展示还没有人送的所有订单
* */

@WebServlet(name = "ShoworderServlet",urlPatterns = "/showorder")
public class ShoworderServlet extends HttpServlet {
    static OrderrServiceImpl orderimpl = null;
    static {
        orderimpl=new OrderrServiceImpl();


    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();

        List<OrderrInfo> selectnosendidorder = orderimpl.selectnosendidorder();
        //直接对所有的没有人送的订单进行查询再返回
        JSONObject backjson = new JSONObject();
        //设置正确的响应码和信息
        backjson.put("status", 200);
        backjson.put("data", selectnosendidorder);
        //打印输出
        out.println(JSON.toJSON(backjson));
        out.flush();
        out.close();

    }
}
